<script lang="ts">
import { defineComponent, toRefs } from 'vue';
import { prefixCls } from '@/settings/designSetting';
import { createAppProviderContext } from './useAppCtx';

export default defineComponent({
	name: 'AppProvider',
	props: {
		prefixCls: { type: String, default: prefixCls },
	},
	setup(props, { slots }) {
		// const isSetState = ref(false);
		const { prefixCls } = toRefs(props);

		// const appStore = useAppStore();

		// 注册app级别的变量
		createAppProviderContext({ prefixCls });

		/**
		 * Used to maintain the state before the window changes
		 */
		// function handleRestoreState() {
		// 	if (unref(isSetState)) {
		// 		isSetState.value = false;
		// 		const { menuMode, menuCollapsed, menuType, menuSplit } = appStore.getBeforeMiniInfo;
		// 		appStore.setProjectConfig({
		// 			menuSetting: {
		// 				type: menuType,
		// 				mode: menuMode,
		// 				collapsed: menuCollapsed,
		// 				split: menuSplit,
		// 			},
		// 		});
		// 	}
		// }
		return () => slots.default?.();
	},
});
</script>
